//
//  Picture.hpp
//  CppDemo
//
//  Created by 蒋益杰 on 16/9/5.
//  Copyright © 2016年 com.ed. All rights reserved.
//

#ifndef Picture_hpp
#define Picture_hpp

#include <iostream>

class Picture {
    
    friend std::ostream& operator<<(std::ostream&, const Picture&);
    friend Picture frame(const Picture&);
    friend Picture operator&(const Picture&, const Picture&);
    friend Picture operator|(const Picture&, const Picture&);
    
public:
    Picture();
    Picture(const char * const*, int);
    Picture(const Picture&);
    ~Picture();
    
    Picture& operator=(const Picture&);
    
private:
    int height, width;
    char *data;
    void copyblock(int, int, const Picture&);
    char& position(int, int);
    char position(int, int) const;
    void clear(int, int, int, int);
    void init(int, int);
    static int max(int, int);
    
};

std::ostream& operator<<(std::ostream&, const Picture&);

Picture frame(const Picture&);
Picture operator&(const Picture&, const Picture&);
Picture operator|(const Picture&, const Picture&);

#endif /* Picture_hpp */
